//The Program Runnable by the User to activate
//the client and client server programs

   import java.io.*;
   import java.util.*;
	import javax.swing.*;

   public class UserRunnable
   {
   
      public static void main(String[] args)
      {
      
         new UserRunnable();
      
      }
   
      public UserRunnable()
      {
         boolean flag = false;  
         while(!flag)
         {
            
				String choice1In = JOptionPane.showInputDialog("Please select an Option: \n" + 
         	"1. Connect to a conversation; \n" +
         	"2. Create a conversation; \n" +
         	"3. Exit");
            int choice = Integer.parseInt(choice1In);
				
				boolean pri = false;
				boolean correct = false;
				
				do
				{
			
				String choice2In = JOptionPane.showInputDialog("Do you wish to connect privatly?: \n" + 
         	"1. Yes \n" +
         	"2. No");
            int choice2 = Integer.parseInt(choice2In);
				
				if(choice2 == 1)
				{
				
					pri = true;
					correct = true;
					
				}
				else if(choice2 == 2)
				{
				
					pri = false;
					correct = true;
				
				}
				else
				{
				
					correct = false;
				
				}
				
				}
				while(!correct);
         	
				String name = JOptionPane.showInputDialog("Type a Display Name that the Other Users Will See...");  
				
            switch(choice)
            {
            
               case 1:
                  flag = true;
      				new Client(pri, name);						
                  break;
            
               case 2:
                  flag = true;
               	new clientServer(pri, name);
                  break;
            
               case 3:
                  flag = true;
                  System.out.println("Good Bye");
                  break;
            
               default:
                  flag = false;
                  break;
            }
         }
      }
   }